const App = getApp();
const navigationBarHeight = (getApp().diygwstatusBarHeight + 44) + 'px'
Page({
    data: {
        tabs1: ['房型简介', '房型评价'],
        activeIndex1: 0,
        scrollLeft: 0,
        msgs2: [],
        msgs1: [],
        url: App.Config.basePath,

    },

    //弹出提示信息
    showModal(message) {
        App.WxService.showModal({
            title: '友情提示',
            content: message,
            showCancel: !1,
        });
    },
    onShareAppMessage: function () {
    },

    //页面加载
    onLoad(option) {
        if (option) {
            this.setData({
                globalOption: option
            })
        }
    },

    //页面显示
    onShow() {
        this.getMsgs1();
        this.getMsgs2();
    },

    //页面跳转
    navigateTo(e) {
        App.navigateTo(e.currentTarget.dataset.url, e.currentTarget.dataset);
    },
    //tab切换事件
    tabClick1: function (e) {
        const dataset = e.currentTarget.dataset;
        this.setData({
            activeIndex1: dataset.id,
            scrollLeft: (e.currentTarget.dataset.id - 1) * 60
        });
    },

    getMsgs1() {
        //设置要传递的参数
        let param = {
            f: 2,
            id: this.data.globalOption.id,
            loadmsg: `正在加载中`
        };

        App.HttpService.getData(param, "/roomtype_List").then(data => { //执行服务器Servlet
            this.setData({
                msgs1: data //把从服务器端得到的值赋值给数组
            });
        });
    },

    getMsgs2(isShow) {
        //调用数据
        let param = {
            f: 2,
            rid: this.data.globalOption.id,
            loadmsg: `正在加载中`
        };


        App.HttpService.getData(param, "/assesss_List").then(data => {
            this.setData({
                msgs2: data
            });
        });
    },

})